-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Exclude totally empty subplots #2855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It is now called _subplot_not_empty and selector can be used to choose what is meant by non-empty. The prior tests pass, but new tests for the subset selection criteria have to be introduced.
This tests go.Figure._subplot_not_empty
in test_find_nonempty_subplots.py
@@ -1302,7 +1302,7 @@ def _add_annotation_like( | |||
# if exclude_empty_subplots is True, check to see if subplot is | |||
# empty and return if it is | |||
if exclude_empty_subplots and ( | |||
not self._subplot_contains_trace(xref, yref) | |||
not self._subplot_not_empty(xref, yref, selector=exclude_empty_subplots) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this line mean that one could do fig.add_shape( ... , row="all", col="all", exclude_empty_subplots=["traces", "shapes"])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be clear: i don't think that's necessary, I would just do True
/False
here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could but by default True means "all". I also don't think it's necessary but you get this functionality for free, all that needs to happen is the list of objects to check is made into the keyword argument of the function (and coerced to "all" if it is True). But I can disable that if you want and have it just accept True/False.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's just accept truthy/falsey for now. I think it's easier to not support certain exotic use-cases that then some people depend upon later :)
Also: could you please add a |
That means that truthy values exclude subplots containing absolutely nothing (but not those containing shapes, but no traces, say) and anything falsey adds to all subplots.
OK! should be ready for review. |
closes #2854
We should be able to select subplots containing anything, and also added is the feature to select subplots containing any combination of traces, shapes, annotations or layout_images.